package com.jdwx.opengl.kotlin

open class ClassA {
    init {
        println("init");
    }
    var name:String;
    var age:Int = 0;
    constructor(x:String){
        this.name = x;
    }
    constructor(x:String,y:Int = 10){
        this.name = x;
        this.age = y;
    }
    open fun getAgeValue() : Int{
        return this.age;
    }
}
class ClassB(x:String) : ClassA(x){



}
class ClassC : ClassA{

    constructor(x: String):super(x){

    }

    constructor(x: String,y:Int ):super(x,y){

    }

    override fun getAgeValue() : Int{
        return this.age+10;
    }


}

class InitOrderDemo(name: String) {

    init {
        println("First initializer block that prints ${name}")
    }


    init {
        println("Second initializer block that prints ${name.length}")
    }
}

class Customer(name: String) {
    val customerKey = name.toUpperCase()
}

class AA(val name : String){
    init{
        println("init")
    }
    constructor(sex:String,age:Int):this(sex){
        println("我背构造了")
    }
}

fun main(){
    var a = ClassA("baijinhao",12)

    println( a.name+"=="+a.age )

    var b = ClassB("baijinhao")
    println( b.name+"=="+b.age )


    var c = ClassC("baijinhao2",30)
    println( c.name+"=="+c.age )

    println( "c=="+c.getAgeValue() )


    InitOrderDemo("hello")


    val cc  =  Customer("xiaobai")

    println( "cc.customerKey="+cc.customerKey )


    var aaa = "100"

    println( aaa )
    var c1 = "xiaobai"

    c1 = "tt"

    aaa = "2"



    println( aaa )


    var aa = AA("xiaobai");

    var bb = AA("xiaobai",98);




}